package com.neusoft.neuiotms.dcam.common.converter;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcam.common.dto.DcamInstitutionsUserDTO;
import com.neusoft.neuiotms.dcam.common.model.DcamInstitutionsUser;
import org.springframework.stereotype.Component;

@Component
public class DcamInstitutionsUserConverter extends AbstractConverter<DcamInstitutionsUser, DcamInstitutionsUserDTO> {

    @Override
    public DcamInstitutionsUser toModel(final DcamInstitutionsUserDTO dto) {
        final DcamInstitutionsUser model = new DcamInstitutionsUser();
        model.setName(dto.getName());
        model.setUsername(dto.getUsername());
        return model;
    }

    @Override
    public DcamInstitutionsUserDTO toDTO(final DcamInstitutionsUser model, final boolean forListView) {

        final DcamInstitutionsUserDTO dto = new DcamInstitutionsUserDTO();
        dto.setId(model.getId());
        dto.setName(model.getName());
        dto.setUsername(model.getUsername());
        return dto;
    }

}
